<?php

namespace falcon5\inc\Infrastructure\Providers;

use falcon5\inc\Helpers\UrlHelper;
use lucatume\DI52\ServiceProvider;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;

class FilesystemCacheProvider extends ServiceProvider
{

    public function register()
    {
        $this->container->singleton('fileCache', static function () {
            $host = UrlHelper::getHost();
            $directory = falcon5_cache_dir();
            return new FilesystemAdapter(
                $host,
                0,
                $directory
            );
        });
    }
}